package com.codejam.el.console.jexl;

import org.apache.commons.jexl3.JexlBuilder;
import org.apache.commons.jexl3.JexlContext;
import org.apache.commons.jexl3.JexlExpression;
import org.apache.commons.jexl3.MapContext;

public class JexlTest {

    public static void Test1() {
        JexlContext jexlContext = new MapContext();

        jexlContext.set("var1", 1);
        jexlContext.set("var2", 2);

        JexlBuilder builder = new JexlBuilder();
        JexlExpression expression = builder.create().createExpression("var1 + 2 * var2");

        Object evaluate = expression.evaluate(jexlContext);


        System.out.println("evaluate  " + evaluate.toString());

    }
}
